<include file="Admin:header" />
 


<table  class="search_table" width="100%" name="index_from" id="index_from">
	<tr>
		<td class="search">
			<form action="{:U($module_name.'/index')}" method="get"  <?php if($_REQUEST['startdate']){ ?> style="display:none;" <?php } ?>  id="form_ordinary">
			<input type="hidden" name="g" value="{$Think.GROUP_NAME}" />
			<input type="hidden" name="m" value="{$Think.MODULE_NAME}" />
			<input type="hidden" name="a" class="a" value="{$Think.ACTION_NAME}" />	

			<input id="title" type="text" class="input-text" name="keyword" value="{$Think.get.keyword}" size="10" />
			<select name="searchtype">
			<option value="sn" <eq  name="searchtype" value='sn'>selected="selected"</eq>>订单号</option>
			<option value="username" <eq name="searchtype" value="username">selected="selected"</eq>>客户姓名</option>
			<option value="email" <eq name="searchtype" value="email">selected="selected"</eq>>客户邮箱</option>
			<option value="note" <eq name="searchtype" value="note">selected="selected"</eq>>客户留言</option>
			<option value="tel" <eq name="searchtype" value="tel">selected="selected"</eq>>联系电话</option>
			<option value="zipcode" <eq name="searchtype" value="zipcode">selected="selected"</eq>>邮政编码</option>
			<option value="consignee" <eq name="searchtype" value="consignee">selected="selected"</eq>>收货人</option>
			<option value="address" <eq name="searchtype" value="address">selected="selected"</eq>>收货地址</option>
			<option value="logistics" <eq name="searchtype" value="logistics">selected="selected"</eq>>发货方式</option>
			<option value="trackcode" <eq name="searchtype" value="trackcode">selected="selected"</eq>>跟踪码</option>
			<option value="country" <eq name="searchtype" value="country">selected="selected"</eq>>网站国家</option>
			<option value="saleser" <eq name="searchtype" value="saleser">selected="selected"</eq>>销售员</option>
			<option value="productlist" <eq name="searchtype" value="productlist">selected="selected"</eq>>产品编码</option>
			
			</select>
 
			<select id="status" name="status">
			<option value="">{:L('order_status')}</option>			 
			<option value="0" <if condition="isset($status) && $status ==0">selected="selected"</if>>{%status_0}</option>
			<option value="1" <if condition="isset($status) && $status ==1">selected="selected"</if>>{%status_1}</option>
			<option value="2" <if condition="isset($status) && $status ==2">selected="selected"</if>>{%status_2}</option>
			<option value="3" <if condition="isset($status) && $status ==3">selected="selected"</if>>{%status_3}</option>
			<option value="4" <if condition="isset($status) && $status ==4">selected="selected"</if>>{%status_4}</option>
			<option value="5" <if condition="isset($status) && $status ==5">selected="selected"</if>>{%status_5}</option>
			<option value="6" <if condition="isset($status) && $status ==6">selected="selected"</if>>{%status_6}</option>
			<option value="7" <if condition="isset($status) && $status ==7">selected="selected"</if>>{%status_7}</option>
			</select>

			<select id="website" name="website">
			<option value="">网站名称</option>	
<volist name="website1" id="r">
			<option value="{$r.domain}" <eq name="website" value="$r.domain">selected="selected"</eq>>{$r.domain}</option>
</volist>
			</select>
			<select name="sort">
				<option value="asc" <if condition="$sort =='asc'">selected="selected"</if>>{:L('order_by_asc')}</option>
				<option value="desc" <if condition="$sort =='desc'">selected="selected"</if>>{:L('order_by_desc')}</option>
			</select>

			<select name="listRows">
				
				<option value="15" <if condition="$listRows ==5">selected="selected"</if>>15{:L('listRows')}</option>
				<option value="20" <if condition="$listRows ==20">selected="selected"</if>>20{:L('listRows')}</option>
				<option value="30" <if condition="$listRows ==30">selected="selected"</if>>30{:L('listRows')}</option>
				<option value="50" <if condition="$listRows ==50">selected="selected"</if>>50{:L('listRows')}</option>
				<option value="100" <if condition="$listRows ==100">selected="selected"</if>>100{:L('listRows')}</option>
			</select>
			
			<input type="hidden" id="menuid" name="menuid" value="{$_GET['menuid']}"/>
			<input type="submit" value="{:L('chaxun')}"  class="button" />
			<input type="reset" value="{:L('reset')}" class="button"  />
			<input type="button" value="高级" class="button" OnClick="$('#form_advanced').show();$('#form_ordinary').hide();" />
<?php 
if(strpos($orderfield,'vv')!==false){
?>
			<input type="button" value="导入" class="button" onclick="mo_import()" />
<?php
}
if(strpos($orderfield,'vw')!==false){
?>
			<input type="button" value="导出" class="button tophide" onclick="mo_export()" />
<?php
}
if(strpos($orderfield,'vx')!==false){
?>
			<input type="button" value="打印" class="button" onclick="mo_print()" />
<?php
}
?>
			</form>



<div <?php if(!$_REQUEST['startdate']){ ?> style="display:none;" <?php } ?> id="form_advanced">

			<form action="{:U($module_name.'/index')}" method="get"  id="form_advanced1">
			<input type="hidden" name="g" value="{$Think.GROUP_NAME}" />
			<input type="hidden" name="m" value="{$Think.MODULE_NAME}" />
			<input type="hidden" name="a" class="a" value="{$Think.ACTION_NAME}" />


<input  class="Wdate input-text"  name="startdate" type="text" id="startdate" size="25" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="
<?php 
if($_REQUEST['startdate']){
echo date('Y-m-d H:i:s',$_REQUEST['startdate']); 
}else{
echo date('Y-m-d H:i:s', time()); 
}
?>
" />至
<input  class="Wdate input-text"  name="enddate" type="text" id="enddate" size="25" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="
<?php 
if($_REQUEST['enddate']){
echo date('Y-m-d H:i:s',$_REQUEST['enddate']); 
}else{
echo date('Y-m-d H:i:s', time()); 
}
?>
" />

			<input id="title" type="text" class="input-text" name="keyword" value="{$Think.get.keyword}" size="10" />
			<select name="searchtype">
			<option value="username" <eq name="searchtype" value="username">selected="selected"</eq>>客户姓名</option>
			<option value="email" <eq name="searchtype" value="email">selected="selected"</eq>>客户邮箱</option>
			<option value="note" <eq name="searchtype" value="note">selected="selected"</eq>>客户留言</option>
			<option value="tel" <eq name="searchtype" value="tel">selected="selected"</eq>>联系电话</option>
			<option value="zipcode" <eq name="searchtype" value="zipcode">selected="selected"</eq>>邮政编码</option>
			<option value="consignee" <eq name="searchtype" value="consignee">selected="selected"</eq>>收货人</option>
			<option value="address" <eq name="searchtype" value="address">selected="selected"</eq>>收货地址</option>
			<option value="logistics" <eq name="searchtype" value="logistics">selected="selected"</eq>>发货方式</option>
			<option value="trackcode" <eq name="searchtype" value="trackcode">selected="selected"</eq>>跟踪码</option>
			<option value="country" <eq name="searchtype" value="country">selected="selected"</eq>>网站国家</option>
			<option value="saleser" <eq name="searchtype" value="saleser">selected="selected"</eq>>销售员</option>
			<option value="productlist" <eq name="searchtype" value="productlist">selected="selected"</eq>>产品编码</option>
			</select>

			<select id="status" name="status">
			<option value="">{:L('order_status')}</option>			 
			<option value="0" <if condition="isset($status) && $status ==0">selected="selected"</if>>{%status_0}</option>
			<option value="1" <if condition="isset($status) && $status ==1">selected="selected"</if>>{%status_1}</option>
			<option value="2" <if condition="isset($status) && $status ==2">selected="selected"</if>>{%status_2}</option>
			<option value="3" <if condition="isset($status) && $status ==3">selected="selected"</if>>{%status_3}</option>
			<option value="4" <if condition="isset($status) && $status ==4">selected="selected"</if>>{%status_4}</option>
			<option value="5" <if condition="isset($status) && $status ==5">selected="selected"</if>>{%status_5}</option>
			<option value="6" <if condition="isset($status) && $status ==6">selected="selected"</if>>{%status_6}</option>
			<option value="7" <if condition="isset($status) && $status ==7">selected="selected"</if>>{%status_7}</option>
			</select>

			<select id="website" name="website">
			<option value="">网站名称</option>	
<volist name="website1" id="r">
			<option value="{$r.domain}" <eq name="website" value="$r.domain">selected="selected"</eq>>{$r.domain}</option>
</volist>
			</select>

			<select name="sort">
				<option value="asc" <if condition="$sort =='asc'">selected="selected"</if>>{:L('order_by_asc')}</option>
				<option value="desc" <if condition="$sort =='desc'">selected="selected"</if>>{:L('order_by_desc')}</option>
			</select>

			<select name="listRows">
				<option value="15" <if condition="$listRows ==5">selected="selected"</if>>15{:L('listRows')}</option>
				<option value="20" <if condition="$listRows ==20">selected="selected"</if>>20{:L('listRows')}</option>
				<option value="30" <if condition="$listRows ==30">selected="selected"</if>>30{:L('listRows')}</option>
				<option value="50" <if condition="$listRows ==50">selected="selected"</if>>50{:L('listRows')}</option>
				<option value="100" <if condition="$listRows ==100">selected="selected"</if>>100{:L('listRows')}</option>
			</select>

			<input type="hidden" id="menuid" name="menuid" value="{$_GET['menuid']}"/>
			<input type="submit" value="{:L('chaxun')}"  class="button" />
			<input type="reset" value="{:L('reset')}" class="button"  />
			<input type="button" value="普通" class="button"  OnClick="$('#form_advanced').hide();$('#form_ordinary').show();" />
<?php 
if(strpos($orderfield,'vv')!==false){
?>
			<input type="button" value="导入" class="button" onclick="mo_import()" />
<?php
}
if(strpos($orderfield,'vw')!==false){
?>
			<input type="button" value="导出" class="button tophide" onclick="mo_export1()" />
<?php
}
if(strpos($orderfield,'vx')!==false){
?>
			<input type="button" value="打印" class="button" onclick="mo_print()" />
<?php
}
?>
			</form>
</div>
		</td>
		
	</tr>
</table>

<form name="myform" id="myform" action="" method="post">
<?php
if(strpos($orderfield,'vy')!==false){
?>
			<input type="button" value="单据打印" class="button" onclick="$('.billdiv').show();" />
<span class="billdiv" style="display:none;">
		<select id="template" name="template" onchange=""  class="" validate="" >
		<volist name="templates" id="r">
		<option value="{$r.filename}">{$r.filename}</option>
		</volist>
		</select>
			<input type="button" value="确定" onclick="mo_bill()"  />
			
</span>
<?php
}
?>
<div class="table-list">
    <table width="100%" cellspacing="0" id="print_content">
		<thead> 
            <tr> 
			<th width="30" class="print_hide tophide"><input style="border:0;" type="checkbox" value="" id="check_box" onclick="selectall('ids[]');"></th>          
<?php 
if(strpos($orderfield,'va')!==false){
?>
			<th width="100" align="left">订单号</th> 
<?php
}
if(strpos($orderfield,'vb')!==false){
?>
            <th width="100" align="left">网站名称</th>
<?php
}
if(strpos($orderfield,'vc')!==false){
?>
            <th width="70" align="left">网站国家</th>
<?php
}
if(strpos($orderfield,'vd')!==false){
?>
            <th width="80" align="left">客户姓名</th>
<?php
}
if(strpos($orderfield,'ve')!==false){
?>
            <th width="80" align="left">销售员</th>
<?php
}
if(strpos($orderfield,'vf')!==false){
?>
			<th width="50" align="left">产品编码</th>
<?php
}
if(strpos($orderfield,'vg')!==false){
?>
			<th width="200" align="left" >产品描述</th>
<?php
}
if(strpos($orderfield,'vh')!==false){
?>
			<th width="30" align="left">数量</th>
<?php
}
if(strpos($orderfield,'vi')!==false){
?>
			<th width="80" align="left">单价</th>
<?php
}
if(strpos($orderfield,'vj')!==false){
?>
            <th width="80" align="left">总价格</th>
<?php
}
if(strpos($orderfield,'vk')!==false){
?>
            <th width="50" align="left">订单状态</th> 
<?php
}
if(strpos($orderfield,'vu')!==false){
?>
			<th class="print_hide tophide" width="80">{:L('manage')}</th> 
<?php
}
?>
            </tr> 
        </thead> 
      	<tbody>
      		<volist name="list" id="vo" key="k">
      		<tr>
			<td align="center" class="print_hide tophide"><input class="inputcheckbox " name="ids[]" value="{$vo['id']}" type="checkbox" ></td>
<?php 
if(strpos($orderfield,'va')!==false){
?>
      		<td>{$vo.sn}</td>
<?php
}
if(strpos($orderfield,'vb')!==false){
?>
			<td>{$vo['domain']}</td> 
<?php
}
if(strpos($orderfield,'vc')!==false){
?>
			<td>{$vo['country']}</td> 
<?php
}
if(strpos($orderfield,'vd')!==false){
?>
            <th width="80" align="left">{$vo['username']}</th>
<?php
}
if(strpos($orderfield,'ve')!==false){
?>
			<td>{$vo['saleser']}</td> 
<?php
}
?>
			<td colspan="4">
			<table width="100%">
			<volist name="vo['sublist']" id="voo">
							<tr>
<?php 
if(strpos($orderfield,'vf')!==false){
?>
							<td width="50">{$voo['productcode']}</td>
<?php
}
if(strpos($orderfield,'vg')!==false){
?>
							<td width="200">{$voo['pbody']}</td>
<?php
}
if(strpos($orderfield,'vh')!==false){
?>
							<td width="30">{$voo['num']}</td>
<?php
}
if(strpos($orderfield,'vi')!==false){
?>
							<td width="80">{$voo['price']|number_format=###,2} {$vo.currency}</td>
<?php
}
?>
							<!--<td>{$vo.currency} {$voo['n_price']|number_format=###,2}</td>-->
							</tr>
			</volist>
			</table>
			</td>
<?php 
if(strpos($orderfield,'vj')!==false){
?>
			<td><font color="red">{$vo.price|number_format=###,2}</font> {$vo.currency}</td>
<?php
}
if(strpos($orderfield,'vk')!==false){
?>
      		<td><if condition="$vo['status'] ==0"><span style="color:#000000">{%status_0}</span></if>
				<if condition="$vo['status'] ==1"><span style="color:#FF0000">{%status_1}</span></if>
				<if condition="$vo['status'] ==2"><span style="color:#00FF00">{%status_2}</span></if>
				<if condition="$vo['status'] ==3"><span style="color:#0000FF">{%status_3}</span></if>
				<if condition="$vo['status'] ==4"><span style="color:#FFFF00">{%status_4}</span></if>
				<if condition="$vo['status'] ==5"><span style="color:#00FFFF">{%status_5}</span></if>
				<if condition="$vo['status'] ==6"><span style="color:#FF00FF">{%status_6}</span></if>
				<if condition="$vo['status'] ==7"><span style="color:#999999">{%status_7}</span></if>
			</td>
<?php
}
if(strpos($orderfield,'vu')!==false){
?>
			<td align="center" class="print_hide tophide" width="80"><a href="{:U($module_name.'/edit',array(id=>$vo['id']))}">{:L('edit')}</a> | <a href="javascript:confirm_delete('{:U($module_name.'/delete',array(id=>$vo['id']))}')">{:L('delete')}</a></td>   
<?php
}
?>
      		</tr>
      		</volist>
      	</tbody>
    </table>
    <div class="btn" class="print_hide tophide"><input type="button" class="button" name="dosubmit" value="<?php echo L('delete')?>" onclick="myform.action='{:U($module_name.'/deleteall')}';return confirm_deleteall()"/></div> 

</form></div>    

<div id="pages" class="page  print_hide">{$page}</div>
<script>
$("#catid").attr("value",'{$catid}');
function confirm_deleteall(){
	art.dialog.confirm("{:L('real_delete')}", function(){ $('#myform').submit();});
}
function mo_print(){
		window.open(location.href+'&pdf=1','Print_Window','height='+ new String(screen.availHeight-28) + ',top=0,left=0,width=' + new String(screen.availWidth-10) + ',location=no,menubar=no,scrollbars=yes,resizable=no,toolbar=no,status=no');
/*
	if(self==top){
		$('.print_hide').hide();
		$('#print_content').show();
		window.print();
		window.close();
	}else{
		window.open(location.href,'Print_Window','height='+ new String(screen.availHeight-28) + ',top=0,left=0,width=' + new String(screen.availWidth-10) + ',location=no,menubar=no,scrollbars=yes,resizable=no,toolbar=no,status=no');
	}
*/
}
function mo_import(){
url='?g=Admin&m=Attachment&a=showloadpage1&file_limit=50&file_types=xls&file_size=500&moduleid=3&mo_import=1&mo_model=order';
		art.dialog.open(url, {
		title: '导入文件',
		lock: 'true',
		window: 'top',
		width: 600,
		height: 455,
		});
}
function mo_export(){
	$('#print_content').val('export');
	$('.a').val('export');
//	$('form')[0].submit();
	$('#form_ordinary').submit();

}
function mo_export1(){
	$('#print_content').val('export');
	$('.a').val('export');
	$('#form_advanced1').submit();

}
function mo_bill() 
{ 

var   previewWindow;    
 
if(previewWindow   ==   null){    
      previewWindow   =   window.open("{:U($module_name.'/bill')}",'myWin','height='+ new String(screen.availHeight-28) + ',top=0,left=0,width=' + new String(screen.availWidth-10) + ',location=no,menubar=no,scrollbars=yes,resizable=no,toolbar=no,status=no'); 
}else   if(previewWindow.closed   ==   true){    
      previewWindow   =   window.open("{:U($module_name.'/bill')}",'myWin','height='+ new String(screen.availHeight-28) + ',top=0,left=0,width=' + new String(screen.availWidth-10) + ',location=no,menubar=no,scrollbars=yes,resizable=no,toolbar=no,status=no'); 
}    

myform.target   =   previewWindow.name;    
myform.action   =   "{:U($module_name.'/bill')}"
myform.submit();    
previewWindow.focus();    






}


$(document).ready(function(){
	if(self==top){
		$('.tophide').hide();
	}
})

var isshow=Array();
function showsublist(index){
	if(isshow[index]){
		isshow[index]=false;
	}else{
		isshow[index]=true;
	}
	if(isshow[index]){
		$('#mo_'+index).show();
	}else{
		$('#mo_'+index).hide();
	}
}



</script>